		TITLE	TXTOMF - Copyright (C) SLR Systems 1994

		INCLUDE	MACROS

		PUBLIC	MOVE_TEXT_TO_OMF,MOVE_DSSIAX_TO_NEWOMF,MOVE_NEWOMF_ASCIZ


		.CODE	PASS2_TEXT

MOVE_TEXT_TO_OMF	PROC
		;
		;RETURNS LENGTH IN EAX
		;
		PUSHM	ESI,EDI

		LEA	ECX,[EDI+2]
		INC	EDI
L11$:
		MOV	EAX,[ESI]
		ADD	ESI,4

		MOV	[EDI],EAX
		ADD	EDI,4

		OR	AL,AL
		JZ	L13$

		OR	AH,AH
		JZ	L14$

		TEST	EAX,00FF0000H
		JZ	L15$

		TEST	EAX,0FF000000H
		JNZ	L11$

		MOV	EAX,EDI
L12$:
		MOV	EDI,EAX
		SUB	EAX,ECX

		CMP	EAX,255
		JA	L3$

		ADD	ESP,8
		MOV	[ECX-2],AL

		DEC	EDI

		RET

L13$:
		LEA	EAX,[EDI-3]
		JMP	L12$

L14$:
		LEA	EAX,[EDI-2]
		JMP	L12$

L15$:
		LEA	EAX,[EDI-1]
		JMP	L12$

L3$:
		POPM	EDI,ESI
;		JMP	MOVE_DSSIAX_TO_NEWOMF

MOVE_TEXT_TO_OMF	ENDP


MOVE_DSSIAX_TO_NEWOMF	PROC
		;
		;DS:SI POINTS TO STRING
		;AX IS STRING LENGTH
		;ES:DI IS DESTINATION
		;
		MOV	ECX,EAX
		MOV	[EDI],AL

		CMP	EAX,255
		JA	L5$

		INC	EDI

		OPTI_MOVSB

		RET

L5$:
		MOV	DPTR [EDI],0FFH

		MOV	[EDI+2],EAX
		ADD	EDI,4

		OPTI_MOVSB

		RET

MOVE_DSSIAX_TO_NEWOMF	ENDP


MOVE_NEWOMF_ASCIZ	PROC
		;
		;
		;
		PUSHM	EDI,ESI

		LEA	ESI,[ECX+1]
		MOV	CL,[ECX]	;SYMBOL LENGTH

		MOV	EDI,EAX
		AND	ECX,0FFH

		CMP	CL,-1		;-1 MIGHT BE SPECIAL
		JNZ	L3$

		MOV	AL,[ESI]

		TEST	AL,AL
		JNZ	L3$

		MOV	CX,[ESI+1]
		ADD	ESI,3
L3$:
		OPTI_MOVSB

		MOV	[EDI],CL

		POPM	ESI,EDI

		RET

MOVE_NEWOMF_ASCIZ	ENDP


		END

